<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <div th:insert ="/demo/include/base::commHead"></div>
    <title>填写融资申请</title>
    <style>
        .form{}
        .form .error{ color: #f30; margin-left: 20px; display: none;}
        .form .tips{margin-left: 5px;}
    </style>

    <style>
        .type_0 .type_0{ display: block !important;}
        .type_0 tr.type_0{ display: grid !important;}

        .type_1 .type_1{ display: block !important;}
        .type_1 tr.type_1{ display: grid !important;}
    </style>
        <script type="text/javascript" th:src="@{/common/uploader/uploader.js}"></script>
        <link th:href="@{/common/uploader/uploader.css}" rel="stylesheet" type="text/css">
</head>
<body class="ht">
<div th:insert="base::loading"></div>
<div class="tabTitle"><span><i class="mdi mdi-menu-up"></i>申请融资</span></div>
<div class="content-wrapper">
    <div class="breadCrumb">
        <i class="mdi mdi-map-marker"></i>
        <span>lucky业务系统<i class="mdi mdi-chevron-double-right"></i>融资服务<i class="mdi mdi-chevron-double-right"></i>我要融资</span>
    </div>
    <form name="form" id="form" class="form" method="post" novalidate>
        <input type="hidden" name="token">
        <div class="card mb-3">
            <div class="card-body">
                <h4 class="card-title">
                    <span>金融产品信息</span>
                    <a id="productSelectorBtn" class="btn btn-primary btn-sm" href="productSelector" role="openFrameWindow">选择</a>
                </h4>
                <div class="alert alert-warning"><i class=" mdi mdi-alert-circle"></i>该业务仅支持向一家资金方申请融资；撤销/终止已有融资关系后，可变更资金方或金融产品。</div>
                <div class="module">
                    <p style="line-height: 3em">异步模式</p>
                    <div id="productDetail">
                        <table cellpadding="0" cellspacing="0" class="hTable">
                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>产品名称</th>
                                <th>资金方</th>
                                <th>适用区域</th>
                                <th>发布时间</th>
                                <th>贷款金额（万元）</th>
                                <th>贷款期限（月）</th>
                                <th>参考利率</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td><p class="rowId"></p></td>
                                <td><p class="productName"></p></td>
                                <td><p class="bankOrgName"></p></td>
                                <td><p class="areaName"></p></td>
                                <td class="time"><p class="publishTimeStr"></p></td>
                                <td class="amount"><p class="amount"></p></td>
                                <td><p class="timeLimit"></p></td>
                                <td><p class="rate"></p></td>
                            </tr>
                            </tbody>
                            <input type="hidden" name="productId" value="" />
                            <input type="hidden" name="bankOrgId" value="" />
                        </table>
                    </div>

                    <p style="line-height: 3em">网页模式</p>
                    <div>
                        <iframe src="productDetail" id="productDetail1Frame" frameborder="0" scrolling="no" seamless width="100%"></iframe>
                    </div>
                </div>
            </div>
        </div>

        <div class="card mb-3">
            <div class="card-body">
                <h4 class="card-title">融资申请信息</h4>
                <div class="module">
                    <table cellpadding="0" cellspacing="0" class="vTable">
                        <tbody>
                        <tr>
                            <th class="label">医保统筹区</th>
                            <td>
                                <div role="SelectGroup" data-options="url:'/app/base/area/',defaultText:'请选择'">
                                    <select name="province">
                                        <option th:value="*{province}" class="selected" selected role="OptionSelected"></option>
                                    </select>
                                    <select name="city" style="width: auto">
                                        <option th:value="*{city}" class="selected" selected role="OptionSelected"></option>
                                    </select>
                                    <select name="county" style="width: auto">
                                        <option th:value="*{county}" class="selected" selected role="OptionSelected"></option>
                                    </select>
                                </div>

                            </td>
                        </tr>
                        <tr class="">
                            <th class="label">定点机构类型</th>
                            <td><input type="text" name="miOrgType" maxlength="50" /><span class="error"></span></td>
                        </tr>
                        <tr>
                            <th class="label">申请金额</th>
                            <td><input type="amount" data-options="minValue:0" name="financeAmount" th:value="${dto.financeAmount}"/><span class="error"></span><span class="ml-1 tips">仅可以输入数和小数点，最多输入12位整数和2位小数</span></td>
                        </tr>
                        <tr>
                            <th class="label">申请币种</th>
                            <td>人民币元</td>
                        </tr>
                        <tr>
                            <th class="label">融资期限</th>
                            <td>
                                <select id="financeLimit" name="financeLimit" >
                                    <option value="">请选择</option>
                                    <option value="1">1-3月</option>
                                    <option value="2">4-6月</option>
                                    <option value="3">7-9月</option>
                                    <option value="4">10-12月</option>
                                    <option value="5">13-24月</option>
                                    <option value="6">25-36月</option>
                                    <option value="7">36月以上</option>
                                </select >
                                <span class="error"></span>
                            </td>
                        </tr>
                        <tr>
                            <th class="label">借款用途</th>
                            <td><textarea name="financePurpose" maxlength="500"></textarea><span class="error"></span><span class="ml-1 tips">不超过500位</span></td>
                        </tr>
                        <tr>
                            <th class="label">主体信息表</th>
                            <td><a class="textLink-primary" role="openFrameWindow">主体信息表</a><span class="tips">（提示：信息由相关主管机构共享及更新，请确认是否准确，如有异议，请在下方备注栏说明。）</span></td>
                        </tr>
                        <tr>
                            <th><b>医保结算账户信息</b></th>
                            <td></td>
                        </tr>
                        <tr>
                            <th class="label">开户名称</th>
                            <td><input type="text" name="accountName" maxlength="200" /><span class="error"></span><span class="ml-1 tips">长度不能超过200位</span></td>
                        </tr>
                        <tr>
                            <th class="label">银行账号</th>
                            <td><input type="text" name="accountNo" maxlength="50" /><span class="error"></span><span class="ml-1 tips">长度不能超过50位</span></td>
                        </tr>
                        <tr>
                            <th class="label">开户行</th>
                            <td><input type="text" name="accountBank" maxlength="200" /><span class="error"></span><span class="ml-1 tips">长度不能超过200位</span></td>
                        </tr>
                        <tr>
                            <th class="label">联系人</th>
                            <td><input type="text" name="contactName" maxlength="20" /><span class="error"></span><span class="ml-1 tips">联系人输入长度不能超过20位</span></td>
                        </tr>
                        <tr>
                            <th class="label">移动电话</th>
                            <td><input type="mobile" name="contactMobile" maxlength="11" /><span class="error"></span><span class="ml-1 tips">仅业务变动提醒，短信服务免费</span></td>
                        </tr>
                        <tr>
                            <th>固定电话</th>
                            <td><input type="text" name="contactTel" maxlength="20" /><span class="ml-1 tips">输入的固定号码不能超过20位</span></td>
                        </tr>
                        <tr>
                            <th>备注</th>
                            <td><textarea name="financeRemark" maxlength="500" ></textarea><span class="ml-1 tips">长度不能超过500位</span></td>
                        </tr>
                        <tr>
                            <th>签发授权-日期关联</th>
                            <td>
                                <!--<p><span class="mr-1">授权起始日</span><input disabled="disabled" class="ht-dateInput" type="date" name="authStartTime" placeholder="" data-options="endSelector:'[name=authEndTime]'" style="background-color: #eee; color:#999;" /></p>-->
                                <p><span class="mr-1">授权起始日</span><input class="ht-dateInput" type="date" name="authStartTime" placeholder="" data-options="endSelector:'[name=authEndTime]'" /></p>
                                <p><span class="mr-1">授权截止日</span><input class="ht-dateInput" type="date" name="authEndTime" placeholder="" data-options="startSelector:'[name=authStartTime]'"/></p>
                                <p><span class="mr-1">授权书编号</span><a name="authDetail" class="textLink-primary" role="openFrameWindow">授权书</a><input type="hidden" name="authNo"/><input type="hidden" name="authId"/><span class="error"></span></p>
                                <p>
                                    <a id="signAuth" class="btn btn-outline-primary btn-sm" >签发授权书</a>
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <th>业务规则</th>
                            <td>
                                <p>
                                    <input name="guize1" type="checkbox" />
                                    <span class="ml-1">我知悉并同意授权资金方通过乐乐应收账款融资服务平台查询我方主体信息、医保结算信息等。</span>
                                </p>
                                <p>
                                    <input name="guize2" type="checkbox" />
                                    <span class="ml-1">我已认真阅读并同意<a class="textLink-primary" role="openFrameWindow" href="demo/finance/businessRules">《乐乐lucky业务规则》</a>。</span>
                                </p>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div class="row" style="padding-top: 20px">
                        <input class="btn btn-primary btn-lg" type="submit" value="提 交" />
                        <input class="btn btn-clear" type="clear" role="ClearButton" value="清空">
                    </div>
                </div>
            </div>
        </div>
    </form>

</div>
<div class="ht-dialog auto" role="autoOpenDialog">
    <div class="wrapper">
        <h4 class="title" th:text="${result.msg}">提示</h4>
        <a class="ht-closeButton">close</a>
        <div class="content">
            <ul th:if="${#fields.hasErrors('dto.*')}">
                <li th:each="err:${#fields.errors('dto.*')}" th:text="${err}"></li>
            </ul>
        </div>
    </div>
</div>


<script>
    function setProductById(id){
        //异步加载模式
        loadProductById(id);
        //网页加载模式
        $("#productDetail1Frame").attr("src","productDetail?id="+id);
    }
    function loadProductById(id){
        var options={
            url:"productDetailData?id="+id,
            success(res){
                console.log(res);
                var data = res.vo;

                $("[name=productId]").val(data.id);
                $("[name=bankOrgId]").val(data.bankOrgId);

                $("#productDetail .rowId").text(22);
                $("#productDetail .productName").text(data.productName);
                $("#productDetail .bankOrgName").text(data.bankOrgName);
                $("#productDetail .bankOrgName").attr('href','base/bank/detail?id='+data.bankOrgId);
                $("#productDetail .areaName").text(data.areaName);
                $("#productDetail .publishTimeStr").text(data.publishTimeStr);
                $("#productDetail .amount").text(data.amount);
                $("#productDetail .timeLimit").text(data.timeLimit);
                $("#productDetail .rate").text(data.rate);

                ht.closeAllFrameWindow();
            },
            fail(err){
                console.log(err);
            }
        };
        $.ajax(options)
    }

    var ruleParser=new RuleParser("#form");
    ruleParser.loadRule(baseUrl+"/demo/finance/createFormRule.json")

</script>
</body>
</html>